/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#include <stdafx.h>

#include "ui绘制工具_组合部件.h"

#include "ui绘制模板.h"
#include <basic_Color.h>




ui_绘制工具_滚动条::ui_绘制工具_滚动条() {
}

void ui_绘制工具_滚动条::f_Draw点(S_2D画布* 画布, uint16 属性ID) {
	//f_ui绘制模板_凸边矩形绘制(画布, m_ID, 属性ID);
}

bool ui_绘制工具_滚动条::f_alloc(S_2D画布* 画布, uint32 num, float32 厚度) {
	bool GPU参数重新配置 = false;

	f_vg_set实例数量(画布, m_ID.id_元素, num*4);


	//m_map指针 = f_ui绘制模板_map参数指针(画布, m_ID);

	m_厚度 = 厚度;
	return GPU参数重新配置;
}

void ui_绘制工具_滚动条::f_set(S_2D画布* 画布, C_Widget* 滚动条, uint32 offset)
{
	offset *= 4;


	m_map指针.p变换[offset].row0 = 滚动条->m_Pos;
	m_map指针.p变换[offset].row1 = 滚动条->m_Size;
	m_map指针.p变换[offset].row2 = { 6, 0 };

	m_map指针.p颜色[offset] = f_PackData4X8(滚动条->m_颜色A);
	m_map指针.p图元[offset] = S_Widget预设图元::m_圆角矩形;

	auto e = 滚动条->f_get更新部件();
	if (e.m_Num == 1) {
		++offset;
		m_map指针.p变换[offset].row0 = 滚动条->m_Pos + e.m_W[0]->m_Pos;
		m_map指针.p变换[offset].row1 = e.m_W[0]->m_Size;
		m_map指针.p变换[offset].row2 = { 6, 0 };

		m_map指针.p颜色[offset] = f_PackData4X8(滚动条->m_颜色A + S_RGBA8UI{ 10,10,10,0 });
		m_map指针.p图元[offset] = S_Widget预设图元::m_圆角矩形;

	}
	else if(e.m_Num == 3) {

	}

	

	
}

void ui_绘制工具_滚动条::f_End(S_2D画布* 画布)
{
	f_ui绘制模板_unmap参数指针(画布, m_ID);
	m_map指针 = {};
}




